/*
 * 题库
 */

import { createAPI } from '@/utils/request'

class Question {
  // 基础题库列表
  list = data => createAPI('/questions', 'get', data)

  // 基础题库详情
  detail = data => createAPI(`/questions/${data.id}`, 'get', data)

  // 批量导入题
  batch = data => createAPI('/questions/batch', 'post', data)

  // 基础题库添加
  add = data => createAPI('/questions', 'post', data)

  // 基础题库修改
  update = data => createAPI(`/questions/${data.id}`, 'put', data)

  // 基础题库删除
  remove = data => createAPI(`/questions/${data.id}`, 'delete', data)

  // 精选题库加入取消
  choiceAdd = data => createAPI(`/questions/choice/${data.id}/${data.choiceState}`, 'patch', data)

  // 精选题库列表
  choice = data => createAPI('/questions/choice', 'get', data)

  // 精选题库上下架
  choicePublish = data => createAPI(`/questions/choice/${data.id}/${data.publishState}`, 'post', data)

  // 试题审核
  choiceCheck = data => createAPI(`/questions/check/${data.id}`, 'post', data)

  // 试题审核意见列表
  auditOpinions = data => createAPI(`/questions/${data.id}/auditOpinions`, 'get', data)

  // 出题记录
  setRecords = data => createAPI(`/questions/${data.id}/setRecords`, 'get', data)

  // 组题列表
  randoms = data => createAPI('/questions/randoms', 'get', data)

  // 组题列表删除
  removeRandoms = data => createAPI(`/questions/randoms/${data.id}`, 'delete', data)
}
export default new Question()
